package com.permission_demo.service;

import org.springframework.stereotype.Component;

import java.util.HashSet;
import java.util.Set;

@Component
public class PermissionService {

    // 实际从登录成功的用户数据中获取该用户所有角色的权限并集
    private static Set<String> CURRENT_USER_PERMISSION = new HashSet<>();
    static {
        CURRENT_USER_PERMISSION.add("user_manage$view");
    }

    public boolean hasPermission(String permission) {
        return CURRENT_USER_PERMISSION.contains(permission);
    }
}
